package com.example.tobisfirstapp;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.MenuItem;

public class ActionBar {

	public boolean handleActionClick(Context c, MenuItem item){
		switch(item.getItemId()){
		case R.id.action_search:
			openSearch();
			return true;
	    case R.id.action_settings:
	            openSettings(c);
	            return true;
	    default:
	            return new Activity().onOptionsItemSelected(item);

		}
	}
	
	
	   private void openSearch(){
	    	System.out.println("open search");
	    }
	    
	   //call the settings-activty from any activity
	    private void openSettings(Context c){
	    	System.out.println("open settings");
	    	Intent intent = new Intent(c, SettingsActivity.class);
	    	c.startActivity(intent);
	    }
}
